#pragma once
#include "DAngularMotor.h"
#include "../DWorld.h"
#include "../DVector3.h"
#include "DJointGroup.h"

namespace Skill
{
	namespace Ode
	{
		namespace Joints
		{		
			DAngularMotor::DAngularMotor(DWorld^ world , DJointGroup^ group)
				:DJoint(world,group)
			{
				dWorldID w = world? world->_This : NULL;
				dJointGroupID g = group? group->_This : NULL;
				_SetPointer(dJointCreateAMotor(w,g),true);
			}
			int DAngularMotor::NumAxes::get()	{return dJointGetAMotorNumAxes(_This);}
			void DAngularMotor::NumAxes::set(int value){dJointSetAMotorNumAxes(_This,value);}

			void DAngularMotor::SetAxis( int anum, int rel, dReal x, dReal y, dReal z)
			{
				dJointSetAMotorAxis(_This,anum,rel,x,y,z);
			}
			void DAngularMotor::SetAxis( int anum, int rel, DVector3^ axis)
			{
				dJointSetAMotorAxis(_This,anum,rel,axis->_This[0],axis->_This[1],axis->_This[2]);
			}
			void DAngularMotor::SetAngle(int anum, dReal angle)
			{
				dJointSetAMotorAngle(_This,anum,angle);
			}

			void DAngularMotor::SetParam(DJointParameters parameter, dReal value)
			{
				dJointSetAMotorParam(_This,(int)parameter, value);
			}
			DAngularMotorMode DAngularMotor::Mode::get()
			{
				return (DAngularMotorMode)dJointGetAMotorMode(_This);
			}

			void DAngularMotor::Mode::set(DAngularMotorMode value)
			{
				return dJointSetAMotorMode(_This,(int)value);
			}

			void DAngularMotor::AddTorques(dReal torque1, dReal torque2, dReal torque3)
			{
				dJointAddAMotorTorques(_This,torque1, torque2, torque3);
			}

			void DAngularMotor::GetAxis(int anum, int rel , DVector3^ result)
			{
				dJointGetAMotorAxis(_This,anum,result->_This);
			}

			int DAngularMotor::GetAxisRel(int anum)
			{
				return dJointGetAMotorAxisRel(_This,anum);
			}
			dReal DAngularMotor::GetAngle(int anum)
			{
				return dJointGetAMotorAngle(_This,anum);
			}

			dReal DAngularMotor::GetAngleRate(int anum)
			{
				return dJointGetAMotorAngleRate(_This,anum);
			}
			dReal DAngularMotor::GetParam(DJointParameters parameter)
			{
				return dJointGetAMotorParam(_This,(int)parameter);
			}
		}
	}
}